<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
	<title>初始化抄表年月</title> 
	
	<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/text.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/form.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/buttons.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/grid.css" type="text/css" media="screen" title="no title" />	
	<link rel="stylesheet" href="../css/layout.css" type="text/css" media="screen" title="no title" />	
	
	<link rel="stylesheet" href="../css/ui-darkness/jquery-ui-1.8.12.custom.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/jquery.visualize.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/facebox.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/uniform.default.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/dataTables.css" type="text/css" media="screen" title="no title" />
	
	<link rel="stylesheet" href="../css/custom.css" type="text/css" media="screen" title="no title">
	<script src="../js/jquery/jquery-3.3.1.js"></script>
	<script type="text/javascript">
	var str="";
	function start(){
		$('#messageDiv').hide();
		$('form').show();
		$.ajax({
			type: "post",
			data:"str="+str,
			url: "/rd-yearmonth/updateRdYear",
			// success: function(msg){
			// 	max=msg;
			// }
		});
		process();
	}
	//var max = 57184;
	var max=0;
	var value = 0;

	$(function(){
		$.ajax({
			type: "GET",
			url: "/rd-volume/queryCount",
			success: function(msg){
				 max=msg;
			}
		});
	});

	function process(){
		value+=10;if(value>max)value=max;
		$( "#progressbar" ).progressbar({ max:max, value: value });
		processShowInfo();
		if(value<max){
			setTimeout(process, 1000);
		}else{
			processComplete();
		}
	}
	function processShowInfo(){
		$('#message').text(value+'户/'+max+'户');
	}
	function processComplete(){
		$('#ok').show();
	}
	function closeModel(){
		var mylay = parent.layer.getFrameIndex(window.name);
		parent.layer.close(mylay);
	}
	</script>
</head> 
 
<body>
<script type="text/javascript">
	Date.prototype.Format = function (fmt) {
		var o = {
			"M+": this.getMonth() + 1, //月份
			"d+": this.getDate(), //日
			"H+": this.getHours(), //小时
			"m+": this.getMinutes(), //分
			"s+": this.getSeconds(), //秒
			"q+": Math.floor((this.getMonth() + 3) / 3), //季度
			"S": this.getMilliseconds() //毫秒
		};
		if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
		for (var k in o)
			if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
		return fmt;
	}
	$(function(){
		showtime();
	});

	function showtime(){
		var date=new Date();
		str= date.Format("yyyy年MM月");
		$(".t1").html(str);
		//延迟执行一次
		window.setTimeout("showtime()",1000);
	}


</script>

<div id="messageDiv">
	<div style="height:80px;text-align:center;padding-top:50px;">
		确定要初始化抄表年月【<span class="t1"></span>】吗？
	</div>
	
	<div class="dialogbutton center">
		<a class="btn" href="javascript:start();" style="width:60px;">是</a>  
		<a class="btn btn-grey" href="javascript:closeModel();" style="width:60px;">否</a>
	</div>
</div>

<form class="form label-inline uniform " style="display:none;">
	<h2>正在初始化【<span class="t1"></span>】的抄表任务...</h2>
	
	<div class="progressContent">
		<span id="message">&nbsp;</span>
		<div id="progressbar"></div>
	</div>
	
	<div class="center">
		<br/>
		<button id="ok" class="btn btn-blue" style="display:none;" onClick="closeModel();">完成</button>
	</div>
</form>

<script src="../js/jquery/jquery-1.5.2.min.js"></script>
<script src="../js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="../js/misc/excanvas.min.js"></script>
<script src="../js/jquery/facebox.js"></script>
<script src="../js/jquery/jquery.visualize.js"></script>
<script src="../js/jquery/jquery.dataTables.min.js"></script>
<script src="../js/jquery/jquery.tablesorter.min.js"></script>
<script src="../js/jquery/jquery.uniform.min.js"></script>
<script src="../js/jquery/jquery.placeholder.min.js"></script>

<script src="../js/widgets.js"></script>
<script src="../js/dashboard.js"></script>

<script type="text/javascript">
	
$(document).ready ( function () 
{
	Dashboard.init ();	
	
	$( "#progressbar" ).progressbar({ max:max, value: 0 });
});



</script>

</body> 
 
</html>